import request from "@/utils/request";
import { CorpForm } from "@/api/account/corp/types";

/**
 * 企业注册
 *
 * @param data
 */
export function corpReg(data: CorpForm) {
  return request({
    url: "/api/v1/account/corp_reg",
    method: "post",
    data: data,
  });
}

/**
 * 企业是否已存在
 *
 * @param data
 */
export function corpExists(code: string) {
  return request({
    url: "/api/v1/account/corp_exists",
    method: "get",
    params: { code: code },
  });
}

//根据token获取企业详情
export function getCorpInfo(editToken: string) {
  return request({
    url: "/api/v1/auth/getCorp/" + editToken,
    method: "get",
  });
}

//完善企业信息
export function corpLogin(data: CorpForm) {
  return request({
    url: "/api/v1/auth/corpLogin",
    method: "put",
    data: data,
  });
}

//获取企业详情
export function getCorp() {
  return request({
    url: "/api/v1/corp/Corp/getCorpInfo",
    method: "get",
  });
}

//修改企业信息
export function updateCorp(data: CorpForm) {
  return request({
    url: "/api/v1/corp/Corp/updateCorp",
    method: "put",
    data: data,
  });
}

//修改企业密码
export function updateCorpPassWord(passWord: string) {
  return request({
    url: "/api/v1/corp/Corp/updateCorpPassWord",
    method: "put",
    params: { passWord:passWord },
  });
}
